package com.wm.yigongfang.controller;

import com.wm.yigongfang.common.web.Result;
import com.wm.yigongfang.common.web.Results;
import com.wm.yigongfang.dto.req.WXLoginReq;
import com.wm.yigongfang.dto.res.WXLoginRes;
import com.wm.yigongfang.service.UserService;
import com.wm.yigongfang.utils.WXUtil;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.sql.rowset.serial.SerialException;

/**
 * @Author ZhangPeng
 * @Date 2024/3/7 18:11
 * @PackageName:com.wm.yigongfang.controller
 * @ClassName: UserController
 * @Description: TODO
 */
@RestController
@RequestMapping("app/user")
public class UserController {

    @Resource
    private UserService userService;

    @PostMapping("wxLogin")
    public Result<WXLoginRes> wxLogin(@RequestBody @Validated WXLoginReq req) throws SerialException {
        return Results.ok(userService.wxLogin(req));
    }
}
